<template>
  <div class="search">
    <f-form ref="form" :action="api.bmp" :form-key="this.formItem.materialPackage100Id">
      <f-form-item  :labelCol="labelCol" :wrapperCol="wrapperCol" v-for="item in busProjectSupplierList" :label="item.supplierName"
                   :name="'supplierNum'+item.index" :value="formItem['supplierNum'+item.index]" dataType="number" type="number"  :required="true"/>

    </f-form>
  </div>
</template>
<script>
  import api from './js/api'

  export default {
    name: 'bmpSupplierNumForm',
    props: {
      detailsParams: {}
    },
    data() {
      return {
        refs: this.$refs,
        api: Object.assign(api, this.api),
        isAdd: true,//是否是添加模式
        loaded: false,//是否加载完成
        formItem: this.getFormItem(),
        busProjectSupplierList: [],
        labelCol: {
          xs: { span: 24 },
          sm: { span: 4 }
        },
        wrapperCol: {
          xs: { span: 24 },
          sm: { span: 20 }
        }
      }
    },
    methods: {
      getFormItem() {
        return {
          materialPackage100Id: '',
          supplierNum1: '',
          supplierNum2: '',
          supplierNum3: '',
          supplierNum4: '',
          supplierNum5: '',
          supplierNum6: '',
          supplierNum7: '',
          supplierNum8: '',
          supplierNum9: '',
          supplierNum10: ''
        }
      },
      //表单赋值
      setData(data) {
        this.getSupplierInfo()
        this.$refs.form.resetFields()
        this.formItem = this.getFormItem()
        if (data && data.materialPackage100Id) {
          let params = {
            materialPackage100Id: data.materialPackage100Id
          }
          this.refs['form'].getDetails(params, (data) => {
            this.formItem = data
            this.loaded = true
          })
          this.isAdd = false
        } else {
          this.loaded = true
        }
      },
      //提交表单
      handleSubmit(callback) {
        this.$refs.form.submit({}, callback)
      },
      getSupplierInfo() {
        this.http.get(this, {
          url: this.api.bmp.getBusProjectSupplierList,
          data: this.detailsParams,
          success(me, data) {
            console.log(data)
            me.busProjectSupplierList = data
          }
        })
      }
    },
    created() {
    },
    components: {}
  }
</script>

<style scoped lang="less" rel="stylesheet/less">

</style>

